package com.lin.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.lin.po.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Update("update user set balance = balance - #{balance} ${ew.customSqlSegment}")
    void minusBalanceByIds(@Param(Constants.WRAPPER) LambdaQueryWrapper<User> wrapper,
                              @Param("balance")Integer balance);

    @Update("update user set balance = balance + #{balance} ${ew.customSqlSegment}")
    void addBalanceByIds(@Param(Constants.WRAPPER) LambdaQueryWrapper<User> wrapper,
                            @Param("balance")Integer balance);

}
